﻿<?php
class colorBlocks{
	public $color;
	public $colorChar;
	private $arrayColors;
	
	private function setArrayColors(){
		$blCor = array();
		$blCor['A'] = 'AA5DA1'; $blCor['B'] = 'a23087'; $blCor['C'] = '289ae6'; $blCor['D'] = 'f231cb'; 
		$blCor['E'] = 'aea436'; $blCor['F'] = 'c41b1c'; $blCor['G'] = 'F9A43E'; $blCor['H'] = '32f548'; 
		$blCor['I'] = 'E4C62E'; $blCor['J'] = '46876e'; $blCor['K'] = 'AD61A7'; $blCor['L'] = 'E1C639'; 
		$blCor['M'] = 'F5845A'; $blCor['N'] = 'F26168'; $blCor['O'] = '971d21'; $blCor['P'] = '2d7a2d'; 
		$blCor['Q'] = '5CA1C0'; $blCor['R'] = 'e6118c'; $blCor['S'] = '714ddf'; $blCor['T'] = '1C8BC2'; 
		$blCor['U'] = '645542'; $blCor['V'] = '673ff1'; $blCor['W'] = '758e33'; $blCor['X'] = '86e5c6'; 
		$blCor['Y'] = '309038'; $blCor['Z'] = 'f5d684'; $blCor['0'] = 'c0a8ae'; $blCor['1'] = '6f3195'; 
		$blCor['2'] = '986f6d'; $blCor['3'] = '90902b'; $blCor['4'] = '18ea8f'; $blCor['5'] = 'c851e0'; 
		$blCor['6'] = '32ba6d'; $blCor['7'] = '27b613'; $blCor['8'] = 'd2ac7b'; $blCor['9'] = '87c88a';
		$this->arrayColors = $blCor;
	}
	
	public function getChar($stringContent){
		if($stringContent == ''){
			return false;
		}
		$IniChar = strtoupper(substr($stringContent, 0, 1));
		$this->colorChar = $IniChar;
		return true;
	}
	
	public function getColor($stringContent){
		$char = $this->getChar($stringContent);
		if($char){
			$this->setArrayColors();
			$char = $this->colorChar;
			$this->color = '#' . $this->arrayColors[$char];
		}else{
			$this->color = '#CCC';
		}
	}
}
?>